<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>
    <div id="app">
        <my-world></my-world>
    </div>
    <script src="../libs/vue/vue.js"></script>
    <script>
        Vue.component('MyWorld', {
            template: `
            <div>
            计数：{{num}}
            <button @click='checked' @keydown='keyr'>累加</button>
            {{sum}}
            </div>
            `,
            data() {
                return {
                    num: 1
                }
            },
            methods: {
                checked() {
                    this.num += this.num
                },
                keyr() {

                }
            },
            computed: {
                sum() {
                    return this.num * 3
                }
            },
        })
        new Vue({
            el: '#app',
            data: {}
        })
    </script>
</body>

</html>